﻿Imports System.Windows.Forms
Imports System.Text
Imports System.Security.Cryptography
Imports Microsoft.VisualStudio.TestTools.UnitTesting
Imports System.IO
Imports System.ServiceProcess
Imports System.Collections.ObjectModel
Imports System.Drawing
Imports System.Globalization
Imports Microsoft.Win32
Imports Microsoft.VisualBasic.FileIO


Module Module1
    Sub documentation()
        My.Computer.FileSystem.CopyFile("C:\Users\Dr Layadi\Documents\Visual Studio 2012\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\D-File", "C:\Doudousoft console\Yes.html", True)
    End Sub
    Sub Main()

        documentation()

        Console.BackgroundColor = ConsoleColor.Black
        Console.ForegroundColor = ConsoleColor.Green

        Console.WriteLine("Doudousoft command console v 0.01 all right reserved 2012 (c)" & vbNewLine & vbNewLine & "Hello in this console demo, enter one of the demos commands by typing help for  more information:" & vbNewLine & "Note!!! : Before typing any command in a newline you should press enter before   the command and after to run it :")
        Dim i As Integer
        i = 2
        While i = 2


            Console.Write(Console.ReadLine & "   :::NewCommand : ")
            Dim k As String
            k = "Command: "
            Dim c As String
            c = Console.ReadLine.ToLower
            If c = "battery-check" Then
                Console.WriteLine(vbNewLine)
                Dim power = SystemInformation.PowerStatus
                Dim percent = power.BatteryLifePercent
                Dim statut = power.BatteryChargeStatus
                Dim stat = power.PowerLineStatus
                Dim core = power.BatteryLifeRemaining
                Console.WriteLine("Percent battery life remaining: " & percent * 100)
                Console.WriteLine(statut * 10 & " %")
                Console.WriteLine(core)
            Else
                If c = "help" Then
                    Console.WriteLine("    battery-check : pour afficher les informations concernant la batterie" & vbNewLine & "    help : pour afficher l'aide" & vbNewLine & "    exit : to end the console" & vbNewLine & "    download average : pour télécharger l'application average")
                Else
                    If c = "try" Then
                        Console.WriteLine(k & "want to try")
                    Else
                        If c = "exit" Then
                            End
                        Else
                            If c = "documentation" Then
                                Process.Start("C:\Doudousoft Console\Chabalala.html")
                            Else

                                If c = "download average" Then
                                    Console.WriteLine("enter the path thatb you would like to make the file in")
                                    Try
                                        My.Computer.Network.DownloadFile("C:\Users\Dr Layadi\Downloads\average_application.ex", Console.ReadLine())
                                    Catch ex As Exception
                                        MessageBox.Show("Une erreur se produite lors du téléchargement de ce fichier soit car:" & vbNewLine & "1.la connexion avec le serveur a échouée" & vbNewLine & "2.le fichiern'existe pas" & vbNewLine & "To check if the connexion to the web is available write this command: Check-Web", "Erreur", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)
                                    End Try
                                    Console.WriteLine("if there is no exception check the specified path to check your file")
                                Else
                                    If c = "check-web" Then
                                        If My.Computer.Network.IsAvailable = True Then
                                            Console.WriteLine("la connexion est disponible")
                                        Else
                                            Console.WriteLine("connexion n'est pas disponible si vous disposez de l'installation réseau essayez de vérifiez votre installation")
                                        End If
                                    Else
                                        If c = "Defender-stop" Then
                                            Dim controller As New ServiceController("WinDefend")
                                            controller.Stop()
                                        Else
                                            Console.WriteLine("!!!cette commande n'est pas reconnu par ce terminal en tant q'une commande      interne ou externe veuillez consultez la documentation de ce terminal")
                                        End If

                                        Dim j As Integer = 5


                                    End If

                                End If

                        End If

                    End If
                End If
            End If
            End If

        End While




    End Sub



    







End Module
